<template>
    <div>
        <div id="head"><p>热门搜索</p></div>
        <ul>
            <li v-for="item in newsList" :key="item.id">
                <p id="le">{{(count++)-1000}}</p>
                <p id="ri">{{item.title}}</p>
            </li>
        </ul>
    </div>
</template>

<script>
import { getApi } from "@/util/api.js";
export default {
  name: "NewsList",

  data() {
    return {
      newsList: [],
      count: 1,
    };
  },

  mounted() {
    this.getNewsList();
  },

  methods: {
    getNewsList() {
      let url = "https://d.app3c.cn/mcm/api/ReBang/";
      getApi(url).then((res) => {
        this.newsList = res.data;
        console.log(this.newsList);
      });
    },
    goto(id) {
      this.$router.push({ name: "detail", params: { id } });
    },
  },
};
</script>

<style lang="scss" scoped>
    div{
        
        #head{
            padding-top: 3vw;
            padding-bottom: 3vw;
            padding-left: 3vw;
            background: rgb(255, 231, 231);
            p{
                font-weight: bold;
                font-size: 6vw;
                font-style: italic;
                color: rgb(233, 47, 47);
            }
        }
        ul{
            li{
                display: flex;
                font-size: 3.5vw;
                border-top: 1px solid #eee;
                line-height: 9vw;
                #le{
                    padding-left: 5vw;
                    padding-top: 2vw;
                    font-weight: bold;
                    color: rgb(243, 100, 61);
                }
                #ri{
                    padding-left: 4vw;
                    padding-top: 2vw;
                }
            }
        }
    }
</style>